/*
 * Copyright (c)  2017
 * All rights reserved.
 * ProductInfo.java 2017-09-13 下午7:47
 */

package com.ueboot.weishop.entity.setting;

import com.ueboot.weishop.entity.IDEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;


/**
 * 描述:商品分类规格定义表，规格决定了价格和库存
 * 用于事先定义好每个分类下的规格项，添加商品时可以让用户自己选择要哪些项目
 * 如机油有如下规格项目：
 * 1.粘度
 * 2.容量
 * 3.系列
 *
 * @author yangkui create on 2017-09-13 下午7:47.
 * @since 1.0
 */
@Data
@NoArgsConstructor
@Entity(name = "WS_SPECIFICATION")
public class SpecificationEntity extends IDEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "WS_SPECIFICATION")
    @GenericGenerator(name = "WS_SPECIFICATION", strategy = "enhanced-table", parameters = {
            @org.hibernate.annotations.Parameter(name = "table_name", value = "WS_TABLE_SEQUENCE"),
            @org.hibernate.annotations.Parameter(name = "segment_value", value = "WS_SPECIFICATION"),
            @org.hibernate.annotations.Parameter(name = "optimizer", value = "pooled") })
    @Column(name = "ID",columnDefinition = "INT(20) COMMENT 'id主键'",length = 20)
    private Long id;

    /**
     * 规格名称
     */
    @Column(name = "NAME",columnDefinition = "VARCHAR(200) COMMENT '规格名称'",length = 200)
    private String name;

    /**
     * 规格值（用于匹配关系使用）
     */
    @Column(name = "VALUE",columnDefinition = "VARCHAR(200) COMMENT '规格值用于(匹配关系使用）'",length = 200)
    private String value;

    /**
     * 所属分类
     */
    @ManyToOne
    @JoinColumn(name="CATEGORY_ID",columnDefinition = "INT(20) COMMENT '所属分类'")
    private CategoryEntity category;
}